<script>
    $(document).ready(function(){
        $("#newEmployeeForm").validate({
            rules: {
			    first_name: "required",
			    last_name: "required",
			    username: {
				    required: true,
				    minlength: 2
			    },
			    password: {
				    required: true,
				    minlength: 5
			    },
			    password_confirmation: {
				    required: true,
				    minlength: 5,
				    equalTo: "#password"
			    },
			    phone: {
    			     number: true,
    			     minlength: 10,
    			     maxlength: 10
                },
                email: "email"
		    }
        });
  });
</script>
<div style="line-height: 22px;">
<%= error_messages_for 'employee' %>
<% form_remote_tag :url => {:action=> "add_employee"}, :html => {:id => "newEmployeeForm"} do %>
    <table style="margin: auto; width: 330px;">
        <tr>
            <td style="" valign="top">
                User Name:
            </td>
            <td>
	            <%= text_field_tag :username, params[:username], :size => 25 %>
            </td>
        </tr>
        <tr>
            <td valign="top">
            	Password:
	        </td>
	        <td>
            	<%= password_field_tag :password, params[:password], :size => 25 %>
	        </td>
        </tr>
        <tr>
            <td valign="top">
        	    Confirm:
	        </td>
	        <td>
                <%= password_field_tag :password_confirmation, params[:password_confirmation], :size => 25 %>
            </td>
        </tr>
        <tr>
            <td valign="top">
        	    First Name:
	        </td>
	        <td>
        	    <%= text_field_tag :first_name, params[:first_name], :size => 25 %>
	        </td>
        </tr>
        <tr>
            <td valign="top">
        	    Last Name:
	        </td>
	        <td>
        	    <%= text_field_tag :last_name, params[:last_name], :size => 25 %>
            </td>
        </tr>
        <tr>
            <td valign="top">
        	    Phone:
	        </td>
	        <td>
	            <%= text_field_tag :phone, params[:phone], :size => 25 %>
            </td>
        </tr>
        <tr>
            <td valign="top">
        	    Email:
	        </td>
	        <td>
        	    <%= text_field_tag :email, params[:email], :size => 25 %>
            </td>
        </tr>    
        <tr>
            <td>
                Other Info:
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <%= text_area_tag :other_info, params[:other_info], :cols => 37, :rows => 4 %>
            </td>
        </tr>
        <tr>
            <td colspan="2">
        	    Is this employee a manager? 
        	    <%= radio_button_tag :is_manager, true %>Yes <%= radio_button_tag :is_manager, false, {:checked => true }%>No
        	    <%=  hidden_field_tag 'act', 'add_employee' %>
                <% if params[:redir] %>
                    <%=  hidden_field_tag 'redir', params[:redir] %>
                <% end %>
            </td>
        </tr>
    </table>
    <br />
    <div style="margin: 2px;">
        <%= submit_tag "Save", :class => "submit" %>   
    </div>
    <% end %>
</div>
<script type="text/javascript">
$(function() {
    $('#username').focus();
});
</script>
